﻿<!DOCTYPE HTML>
<html lang="zh">
<head>
<title>GroupDeactivate - 语法 &amp; 使用 | AutoHotkey v2</title>
<meta name="description" content="The GroupDeactivate function is similar to the GroupActivate function but activates the next window not in the group." />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="../static/theme.css" rel="stylesheet" type="text/css" />
<script src="../static/content.js" type="text/javascript"></script>
<script type="text/javascript">$(function(){0<=window.navigator.userAgent.toLowerCase().indexOf("ucbrowser")&&CaoNiMaDeUc()})</script>
</head>
<body>

<h1>GroupDeactivate</h1>

<p>Similar to <a href="GroupActivate.htm">GroupActivate</a> except activates the next window <strong>not</strong> in the group.</p>

<pre class="Syntax"><span class="func">GroupDeactivate</span> GroupName <span class="optional">, Mode</span></pre>
<h2 id="Parameters">参数</h2>
<dl>

  <dt>GroupName</dt>
  <dd>
    <p>类型: <a href="../Concepts.htm#strings">字符串</a></p>
    <p>The name of the target group, as originally defined by <a href="GroupAdd.htm">GroupAdd</a>.</p>
  </dd>

  <dt>Mode</dt>
  <dd>
    <p>类型: <a href="../Concepts.htm#strings">字符串</a></p>
    <p>If omitted, the function activates the oldest non-member window. To change this behavior, specify the following letter:</p>
    <p><strong>R:</strong> The newest non-member window (the one most recently active) is activated, but only if a member of the group is active when the function is given. &quot;R&quot; is useful in cases where you temporarily switch to working on an unrelated task. When you return to the group via <a href="GroupActivate.htm">GroupActivate</a>, GroupDeactivate, or <a href="GroupClose.htm">GroupClose</a>, the  window you were most recently working with is activated rather than the oldest window.</p>
  </dd>

</dl>

<h2 id="Remarks">备注</h2>
<p>GroupDeactivate causes the first window that does <strong>not</strong> match any of the group's window specifications to be activated. Using GroupDeactivate a second time will activate the next window in the series and so on. Normally, GroupDeactivate is assigned to a hotkey so that this window-traversal behavior is automated by pressing that key.</p>
<p>This function is useful in cases where you have a collection of favorite windows that are almost always running. By adding these windows to a group, you can use GroupDeactivate to visit each window that isn't one of your favorites and decide whether to close it. This allows you to clean up your desktop much more quickly than doing it manually.</p>
<p>GroupDeactivate selects windows in a manner similar to the <kbd>Alt</kbd>+<kbd>Shift</kbd>+<kbd>Esc</kbd> system hotkey. Specifically:</p>
<ul>
  <li>Owned windows, such as certain dialogs and tool windows, are not evaluated. However, if the owner window is eligible for activation, the most recently active owned window is activated instead, unless the owner was active more recently. This is determined by calling <a href="https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getlastactivepopup">GetLastActivePopup</a>.</li>
  <li>Windows with the WS_EX_TOPMOST or WS_EX_NOACTIVATE styles are skipped.</li>
  <li>Windows with the WS_EX_TOOLWINDOW style but without the WS_EX_APPWINDOW style are skipped. (These windows are generally also omitted from Alt-Tab and the taskbar.)</li>
  <li>Disabled windows are skipped, unless a window it owns (such as a modal dialog) was active more recently than the window itself.</li>
  <li>Hidden or cloaked windows are skipped.</li>
  <li>The Desktop is skipped.</li>
</ul>
<p>Although the taskbar is skipped due to the WS_EX_TOPMOST style, it is activated if there are no other eligible windows and the active window matches the group.</p>
<p>关于窗口组的更多细节, 请参阅 <a href="GroupAdd.htm">GroupAdd</a>.</p>
<h2 id="Related">相关</h2>
<p><a href="GroupAdd.htm">GroupAdd</a>, <a href="GroupActivate.htm">GroupActivate</a>, <a href="GroupClose.htm">GroupClose</a></p>
<h2 id="Examples">示例</h2>
<div class="ex" id="ExBasic">
<p><a href="#ExBasic">#1</a></p>
<pre>GroupDeactivate "MyFavoriteWindows"  <em>; 访问非收藏的窗口来清理桌面</em></pre>
</div>

</body>
</html>